
var imagesList = document.getElementsByTagName("img")
function lazyImgCallback (entries) {
  for (let i of entries) {
    if (i.isIntersecting) {
      let img = i.target
      let positionSrc = img.getAttribute('src')
      console.log(positionSrc)
      if (positionSrc == './static/image/placeholder-img.png' || positionSrc === './static/image/placeholder-news.png') {
        let trueSrc = img.getAttribute("data-src")
        img.setAttribute("src", trueSrc)
        observer.unobserve(img)
      }
    }
  }
}
const observer = new IntersectionObserver(lazyImgCallback)
for (let i of imagesList) {
  observer.observe(i)
}
